package com.iyundao.io.mapper;

import com.iyundao.io.model.PermissionDept;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;

@Repository
public interface PermissionDeptMapper {
    @Delete({
        "delete from permission_dept",
        "where sid = #{sid,jdbcType=CHAR}"
    })
    int deleteByPrimaryKey(String sid);

    @Insert({
        "insert into permission_dept (sid, pid, did)",
        "values (#{sid,jdbcType=CHAR}, #{pid,jdbcType=CHAR}, #{did,jdbcType=CHAR})"
    })
    int insert(PermissionDept record);

    @InsertProvider(type=PermissionDeptSqlProvider.class, method="insertSelective")
    int insertSelective(PermissionDept record);

    @Select({
        "select",
        "sid, pid, did",
        "from permission_dept",
        "where sid = #{sid,jdbcType=CHAR}"
    })
    @Results({
        @Result(column="sid", property="sid", jdbcType=JdbcType.CHAR, id=true),
        @Result(column="pid", property="pid", jdbcType=JdbcType.CHAR),
        @Result(column="did", property="did", jdbcType=JdbcType.CHAR)
    })
    PermissionDept selectByPrimaryKey(String sid);

    @UpdateProvider(type=PermissionDeptSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(PermissionDept record);

    @Update({
        "update permission_dept",
        "set pid = #{pid,jdbcType=CHAR},",
          "did = #{did,jdbcType=CHAR}",
        "where sid = #{sid,jdbcType=CHAR}"
    })
    int updateByPrimaryKey(PermissionDept record);
}